<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>就诊界面</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/css/to-doctor.css">
<link rel="stylesheet" href="static/easyui/themes/ui-cupertino/easyui.css">
</head>
<body>
<style type="text/css">
.text-css{
	border: 0px;
    border-bottom: 1px solid #aaa;
    background:#dee;
    text-align: center;
    width: 80px;
    height: 24px;
    outline: none;
    font-style: italic;
}
</style>
<script type="text/javascript">
$(function(){
	
	$('#xiyaoping_dan').datagrid({
		onBeforeEdit:function(index,row){
			$(this).datagrid('updateRow', {index:index,row:{editing:true}})
		},
		onAfterEdit:function(index,row){
			$(this).datagrid('updateRow', {index:index,row:{editing:false}})
		},
		onCancelEdit:function(index,row){
			$(this).datagrid('updateRow', {index:index,row:{editing:false}})
		}
	});
	
	$("#jiuzhenbingren").click(function(){
		//体检加病人时先清空病人信息记录
		$("#name_").textbox("setValue",null); 
		$("#age_").textbox("setValue",null); 
		$("#sex_").textbox("setValue",null);
		$("#dh_").textbox("setValue",null);
		$("#sfz_").textbox("setValue",null);
		$("#dizhi_").textbox("setValue",null);
		$("#menghao").val(null);//把门诊号存进隐藏域做医疗结算结结算调用
		$("#ylkh").val(null);//把医疗卡号存进隐藏域做医疗结算结算调用
		$("#ylkkh").val(null);//把医疗卡卡号存进隐藏域做医疗结算结算调用
		$("#tianjiabingren").window("open");
	})
	
	/* 体检结果表格初始化 */
	$("#tijian_biao").datagrid({
		url:'mztjjg',
		pagination:true,
		fitColumns:true,
	    pageNumber:1,
	    pageSize:5,
	    pageList:[5,6],
	    columns:[[
	    	{field:'mzcard_id',hidden:true,title:'卡号',align:'center'},
	    	{field:'mecard_number',title:'医疗卡号',width:214,align:'center'},
			{field:'examine_id',title:'体检号',width:214,align:'center'},
			{field:'patient_name',title:'病人姓名',width:180,align:'center'},
			{field:'card_cid',title:'身份证号',width:224,align:'center'},
			{field:'examine_time',title:'时间',width:224,align:'center',formatter:comformatDate},
	    ]]
	});
	
	$("#zhiliaoxiangmu_dan").datagrid({
		fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,6],
	    columns:[[
			{field:'cure_id',title:'编号',width:86,align:'center'},
			{field:'cure_name',title:'名称',width:86,align:'center'},
			{field:'cure_je',title:'价格',width:86,align:'center'},
			{field:'zhiliaoxiangmu_dancaozuo',title:'操作',width:86,align:'center',
				formatter:function(value,row,index){
					return "<input type='button' style='background:#E4F1FB;color:#2779AA;border:none' onclick='yshanchu(this,"+row.cure_je+")' value='删除'/>"
				}},
	    ]]
	});
	
	$("#yiliao_xuan").datagrid({
		url:'ylxm',	
	    columns:[[
			{field:'cure_id',title:'编号',width:80,align:'center'},
			{field:'cure_name',title:'名称',width:80,align:'center'},
			{field:'cure_je',title:'价格',width:80,align:'center'}
	    ]]
	});
	
	 $("#tjbg").datagrid({
		url:'findexamin',
		columns:[[
			{field:'examine_item_id',title:'编号',width:310/4,align:'center'},
			{field:'examine_item_name',title:'名称',width:310/4,align:'center'},
			{field:'examine_item_price',title:'价格',width:310/4,align:'center'},
	    ]],
	    onDblClickRow:function(rowIndex,rowDate){
			 var tjxm= $('#tijianxiangmu_dan').datagrid("getRows"); 
			 if(tjxm.length==0){
				 $('#tijianxiangmu_dan').datagrid('appendRow',rowDate); 
				  	var xmdj=rowDate.examine_item_price;//得到选中项目金额
					var jj=parseInt(xmdj); 
					var xm=$("#tjje").text();//得到总金额当前的值
					var ee=parseInt(xm);
					$("#tjje").text(jj+ee);//累计相加重新赋值 
			 }else{
				 var opin = true;
				 for (var i= 0;i<tjxm.length;i++){
					 if(rowDate.examine_item_id==tjxm[i].examine_item_id){
						 opin = false;
					 }
				}	 
				if(opin){
					 $('#tijianxiangmu_dan').datagrid('appendRow',rowDate); 
					  	var xmdj=rowDate.examine_item_price;//得到选中项目金额
						var jj=parseInt(xmdj); 
						var xm=$("#tjje").text();//得到总金额当前的值
						var ee=parseInt(xm);
						$("#tjje").text(jj+ee);//累计相加重新赋值 
				}else{
					return null;
				}
			 }	
		 }
	}); 
	
	 $("#tijianxiangmu_dan").datagrid({
		url:'',
		fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,6],
	    columns:[[
			{field:'examine_item_id',title:'编号',width:86,align:'center'},
			{field:'examine_item_name',title:'名称',width:86,align:'center'},
			{field:'examine_item_price',title:'价格',width:86,align:'center'},
			{field:'tijianxiangmu_dancaozuo',title:'操作',width:86,align:'center',
				formatter:function(value,row,index){
					return "<input type='button' style='background:#E4F1FB;color:#2779AA;border:none' onclick='shanchu(this,"+row.examine_item_price+")' value='删除'/>"
				}},
	    ]]
	});
	 
	$("#bingrencha").click(function(){
		var medid=$("#bingren_patient").datagrid("getSelected");
		if(medid==null){
			$.messager.alert("温馨提示：","未选择病人信息");
		}else{
			var mzcard=medid.mzcard_id;
			var ghmzh=medid.outpatient_id;
			$.ajax({
				url:'zjmedical',
				type:'post',
				data:{
					"mzcard_id":mzcard,
					"outpatient_id":ghmzh,
				},
				success:function(d){
					$("#name_").textbox("setValue",d[0]["patient_name"]); 
					$("#age_").textbox("setValue",d[0]["patient_age"]); 
					$("#sex_").textbox("setValue",d[0]["patient_sex"]);
					$("#dh_").textbox("setValue",d[0]["mzcard_phone"]);
					$("#sfz_").textbox("setValue",d[0]["mzcard_phone"]);
					$("#dizhi_").textbox("setValue",d[0]["home_address"]);
					$("#menghao").val(d[0]["outpatient_id"]);//把门诊号存进隐藏域做医疗结算结结算调用
					$("#ylkh").val(d[0]["mzcard_id"]);//把医疗卡号存进隐藏域做医疗结算结算调用
					$("#ylkkh").val(d[0]["mecard_number"]);//把医疗卡卡号存进隐藏域做医疗结算结算调用
					$("#tianjiabingren").window("close");
					
				}
			})
		}
		
	});
	$("#xiyao_xuan").datagrid({
		url:'xiyao',
	    columns:[[
			{field:'drug_id',title:'编号',width:80,align:'center'},
			{field:'drug_name',title:'名称',width:80,align:'center'},
			{field:'drug_specifications',title:'规格',width:80,align:'center'},
			{field:'drug_selling_price',title:'单价',width:80,align:'center'},
			{field:'ypkc',title:'库存',width:80,align:'center'},
			{field:'drug_type', hidden:true,title:'',width:80,align:'center'},
	    ]]
	});
	
	$("#zhongyao_xuan").datagrid({
		url:'zhongyao',
	    columns:[[
	    	{field:'drug_type',hidden:true,title:'',width:80,align:'center'},
			{field:'drug_id',title:'编号',width:80,align:'center'},
			{field:'drug_name',title:'名称',width:80,align:'center'},
			{field:'drug_specifications',title:'规格',width:80,align:'center'},
			{field:'drug_selling_price',title:'单价',width:80,align:'center'},
			{field:'ypkc',title:'库存',width:80,align:'center'},
	    ]]

	});
	
});
//时间转换
function comformatDate(date){
	var day = new Date(date); 
	var Year = 0; 
	var Month = 0; 
	var Day = 0; 
	var CurrentDate = ""; 
	//初始化时间 
	Year= day.getFullYear();//
	Month= day.getMonth()+1; 
	Day = day.getDate(); 
	Hour = day.getHours(); 
	 Minute = day.getMinutes(); 
	 Second = day.getSeconds(); 
	CurrentDate += Year + "-"; 
	if (Month >= 10 ) { 
		CurrentDate += Month + "-"; 
	}else { 
		CurrentDate += "0" + Month + "-"; 
	} 
	if (Day >= 10 ) { 
		CurrentDate += Day ; 
	}else { 
		CurrentDate += "0" + Day ; 
	} 
	if(Hour>=10){
		CurrentDate +=" "+Hour;
	}else{
		CurrentDate +=" "+"0"+Hour;
	}
	if(Minute>=10){
		CurrentDate +=":"+Minute;
	}else{
		CurrentDate +=":"+"0"+Minute;
	}
	if(Second>=10){
		CurrentDate +=":"+Second;
	}else{
		CurrentDate +=":"+"0"+Second;
	}
	return CurrentDate; 
};
	

function formatAction(value,row,index){
	 if (row.editing){
		var s = '<input type="button" style="background:#E4F1FB;color:#2779AA;border:none" onclick="saverow('+index+')" value="保存"/> ';
		var c = '<input type="button" style="background:#E4F1FB;color:#2779AA;border:none" onclick="cancelrow(this)" value="返回"/> ';
		return s+c;
	} else {
		var e = '<input type="button" style="background:#E4F1FB;color:#2779AA;border:none" onclick="editrow(this)" value="编辑"/> ';
		var d = '<input type="button" style="background:#E4F1FB;color:#2779AA;border:none" onclick="deleterow(this)" value="删除"/> ';
		return e+d;
	} 
}

$.extend($.fn.datagrid.defaults.editors,{
	numberspinner: {
		init: function(container, options){
			var input = $('<input type="text">').appendTo(container);
			return input.numberspinner(options);
		},
		destroy: function(target){
			$(target).numberspinner('destroy');
		},
		getValue: function(target){
			return $(target).numberspinner('getValue');
			
		},
		setValue: function(target, value){
			$(target).numberspinner('setValue',value);
		},
		resize: function(target, width){
			$(target).numberspinner('resize',width);
		}
	}
});

 
function getRowIndex(target){
	var tr = $(target).closest('tr.datagrid-row');
	return parseInt(tr.attr('datagrid-row-index'));
}
function editrow(target){
	$('#xiyaoping_dan').datagrid('beginEdit', getRowIndex(target));
}

function deleterow(target){
	$.messager.confirm('温馨提示','确定删除?',function(r){
		if (r){
			$('#xiyaoping_dan').datagrid('deleteRow',getRowIndex(target));	
			var rows = $('#xiyaoping_dan').datagrid("getRows");
			var sum=0;
			for (var i = 0; i < rows.length; i++) {
				var row = rows[i];
				sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
			}
			 $("#ypje").text(sum);//重新赋值给药品总金 
			
		}
	});
}

function saverow(index){//保存事件
		
		var rows = $('#xiyaoping_dan').datagrid("getRows");
		
		$('#xiyaoping_dan').datagrid('endEdit', index);
		var a = rows[index].prescription_details_yl;
		var b = rows[index].prescription_details_ts;
		var c = rows[index].prescription_details_cs;
		if($.trim(a)==''||$.trim(b)==''||$.trim(c)==''){
			$('#xiyaoping_dan').datagrid('beginEdit', index);
			return;
		}
		 var sum = 0;//定义一个值来存储金额
		 for (var i = 0; i<rows.length;i++) {//循环右边药单所有行取出药品数量和单价相乘
			 if(rows[i]["gms"]==null){
				 $.messager.("温馨提示：",rows[i]["drug_name"]+"请输入购买数量！");
				 rows[i]["gms"]=1;
				 $('#xiyaoping_dan').datagrid('refreshRow',i);
				 var rows = $('#xiyaoping_dan').datagrid("getRows");
				 for (var i = 0; i < rows.length; i++) {
					 var row = rows[i];
						sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
				}
				 $("#ypje").text(sum);//重新赋值给药品总金 
				 break;
			 }else if(rows[i]["gms"]<=0){
				 rows[i]["gms"]=1;
				 $('#xiyaoping_dan').datagrid('refreshRow',i);
				 var rows = $('#xiyaoping_dan').datagrid("getRows");
				 for (var i = 0; i < rows.length; i++) {
					 var row = rows[i];
						sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
				}
				 $("#ypje").text(sum);//重新赋值给药品总金 
				 break;
			 }else if(rows[i]["gms"]>rows[i]["ypkc"]){
				 rows[i]["gms"]=1;
				 $('#xiyaoping_dan').datagrid('refreshRow',i);
				 var rows = $('#xiyaoping_dan').datagrid("getRows");
				 for (var i = 0; i < rows.length; i++) {
					 	var row = rows[i];
						sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
				}
				 $("#ypje").text(sum);//重新赋值给药品总金 
				break;
			 }else if(!(/^[1-9]\d*$/).test(rows[i]["gms"])){
				 rows[i]["gms"]=1;
				 $('#xiyaoping_dan').datagrid('refreshRow',i);
				 var rows = $('#xiyaoping_dan').datagrid("getRows");
				 for (var i = 0; i < rows.length; i++) {
					 var row = rows[i];
						sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
				}
				 $("#ypje").text(sum);//重新赋值给药品总金 
				 break;
			 }else{
				var row = rows[i];
				sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
			 }
			
		 }
		 $("#ypje").text(sum);//重新赋值给药品总金 
}
function cancelrow(target){
		$('#xiyaoping_dan').datagrid('cancelEdit', getRowIndex(target));
}


	
	
	
	//添加病人弹框
 
	
	/*医疗项目表格初始化 */
 
	
	/* 医疗项目添加*/
	 
	
	/* 体检项目*/
 
	
	/* 体检项目添加*/
 
	
	//=============================双击表格，显示体健详情界面
	$('#tijian_biao').datagrid({
		onDblClickCell: function(index,field,value){
			var tijian=$("#tijian_biao").datagrid("getSelected");
			var tjbh=tijian.examine_id;
			$.ajax({
				url:'tjhcJg?examine_id='+tjbh,
				type:'post',
				success:function(d){
					if(d!=null){
						$("#cw_adjustment_id1").textbox("setValue",d[0]["mecard_number"]); 
						$("#cw_adjustment_id2").textbox("setValue",d[0]["examine_id"]); 
						$("#cw_adjustment_id3").textbox("setValue",d[0]["patient_name"]);
						$("#cw_adjustment_id4").textbox("setValue",d[0]["patient_age"]);
						$("#cw_adjustment_id5").textbox("setValue",d[0]["patient_sex"]);
						$("#cw_adjustment_id6").textbox("setValue",d[0]["examine_record_name"]);
						
						$('#exTable2').datagrid({
						    url:'tjhcJgEr?examine_id='+tjbh,
						    columns:[[
						    	{field:'examine_item_name',title:'体检项目',width:100,align:'center'},
								{field:'examine_record_result',title:'体检结果',width:200,align:'center'},
								
						    ]]
						
						});
						
						
					}
				}
			});
			$("#tijianxq").window("open");
		}
	});
 //添加中药
 $("#zhongyao_xuan").datagrid({
	 onDblClickRow:function(rowIndex,rowDate){
		 var zhongyao=$("#xiyaoping_dan").datagrid("getRows");//得到药品表格的所有行
		 if(zhongyao.length==0){//如果他的长度为零,就表示没有一条数据就新增一条
			 rowDate.gms=1;//设置一个药品数量默认值
			 $('#xiyaoping_dan').datagrid('appendRow',rowDate);
				var ypdj=rowDate.drug_selling_price;//得到选中药品的金额
				var ypdjs=parseInt(ypdj);
				
				var dqz=$("#ypje").text();//得到当前的总金额
				var dqzs=parseInt(dqz);
				$("#ypje").text(ypdjs+dqzs);//重新赋值给药品总金额
		 }else{
			 var a;//var一个变量作为得到具体哪一行的参数
			 var opin = true;
			 for (var i= 0;i<zhongyao.length;i++){
				 
					 if(rowDate.drug_id==zhongyao[i].drug_id){
						 opin = false;
						 a=i;
					 }
				}
			 if(opin){//如果判断表格里面没有相同的药品就新增一行
				 rowDate.gms=1;
				 $('#xiyaoping_dan').datagrid('appendRow',rowDate);
				 	var ypdj=rowDate.drug_selling_price;//得到选中药品的金额
				 	var ypdjs=parseInt(ypdj); 
					var dqz=$("#ypje").text();//得到当前的总金额
					var dqzs=parseInt(dqz);
					$("#ypje").text(ypdjs+dqzs);//重新赋值给药品总金额
				 
			 }else{//判断表格里面有相同的药品就数量加一
				 rowDate.gms=parseInt(rowDate.gms)+parseInt(1);
				 $('#xiyaoping_dan').datagrid('updateRow',{index:a,row:{rowDate}}); 
			 }
			 
			 var sum = 0;//定义一个值来存储金额
			 for (var i = 0; i<zhongyao.length; i++) {//循环右边药单所有行取出药品数量和单价相乘
				var row = zhongyao[i];
				sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
			 }
			 $("#ypje").text(sum);//重新赋值给药品总金  
		 }
		 
	 }
 });
 
 //添加西药
 $("#xiyao_xuan").datagrid({
	 onDblClickRow:function(rowIndex,rowDate){
		 var xiyao=$("#xiyaoping_dan").datagrid("getRows");
		 if(xiyao.length==0){//如果他的长度为零,就表示没有一条数据就新增一条
			 rowDate.gms=1;//设置一个药品数量默认值
			 $('#xiyaoping_dan').datagrid('appendRow',rowDate); 
				var ypdj=rowDate.drug_selling_price;//得到选中药品的金额
				var ypdjs=parseInt(ypdj); 
				var dqz=$("#ypje").text();//得到当前的总金额
				var dqzs=parseInt(dqz);
				$("#ypje").text(ypdjs+dqzs);//重新赋值给药品总金额
		 }else{
			 var b;//var一个变量作为得到具体哪一行的参数
			 var opin = true;
			 for (var i= 0;i<xiyao.length;i++){
					 if(rowDate.drug_id==xiyao[i].drug_id){
						 opin = false;
						 b=i;
					 }
				}
			 
			 if(opin){
				 rowDate.gms=1;
				 $('#xiyaoping_dan').datagrid('appendRow',rowDate);
				 	var ypdj=rowDate.drug_selling_price;//得到选中药品的金额
				 	var ypdjs=parseInt(ypdj); 
					var dqz=$("#ypje").text();//得到当前的总金额
					var dqzs=parseInt(dqz);
					$("#ypje").text(ypdjs+dqzs);//重新赋值给药品总金额
				 
			 }else{
				 rowDate.gms=parseInt(rowDate.gms)+parseInt(1);
				 $('#xiyaoping_dan').datagrid('updateRow',{index:b,row:{rowDate}});
			 } 
		 }
		 var sum = 0;//定义一个值来存储金额
		 for (var i = 0; i<xiyao.length; i++) {
			var row =xiyao[i];
			sum = sum + parseInt(row.drug_selling_price)*parseInt(row.gms);
		 }
		 $("#ypje").text(sum);//重新赋值给药品总金 
		
	 }
 });
 
 //==========添加医疗项目
$("#yiliao_xuan").datagrid({
	 onDblClickRow:function(rowIndex,rowDate){
		var zyl= $('#zhiliaoxiangmu_dan').datagrid("getRows"); 
		if(zyl.length==0){
			 $('#zhiliaoxiangmu_dan').datagrid('appendRow',rowDate);
				var xmdj=rowDate.cure_je;//得到选中项目金额
				var jj=parseInt(xmdj);
				var xm=$("#xmje").text();//得到总金额当前的值
				var ee=parseInt(xm);
				$("#xmje").text(jj+ee);//累计相加重新赋值
			
		}else{
			 var opin = true;
			 for (var i= 0;i<zyl.length;i++){
				 if(rowDate.cure_id==zyl[i].cure_id){
					 opin = false;
				 }
			}	 
			if(opin){
				 $('#zhiliaoxiangmu_dan').datagrid('appendRow',rowDate);
					var xmdj=rowDate.cure_je;//得到选中项目金额
					var jj=parseInt(xmdj); 
					var xm=$("#xmje").text();//得到总金额当前的值
					var ee=parseInt(xm);
					$("#xmje").text(jj+ee);//累计相加重新赋值
			}else{
				return null;
			}
		 
		}
		 	
	 }
 });
 //医疗项目删除===就要减去对应的金额
 function yshanchu(row,money){
	$.messager.confirm('项目删除','确定删除?',function(r){
		if (r){
			$('#zhiliaoxiangmu_dan').datagrid('deleteRow', getRowIndex(row));
		}
		var xmmoney=$("#xmje").text();//得到选中项目总金额当前的值
		var xmmoneys=parseInt(xmmoney);//转换格式
		$("#xmje").text(xmmoneys-money);//重新赋值给总金额
	});
 }  
 
 //医疗项目确认单
$(function(){
	$("#xmqr").click(function(){
		$("#xmje").text(0);//成功后重新赋值
		$('#zhiliaoxiangmu_dan').datagrid("loadData",{total:0,rows:[]});
	});
}); 
//=========开设体检项目
//体检项目删除===就要减去对应的金额
 function shanchu(row,money){
	$.messager.confirm('项目删除','确定删除?',function(r){
		if (r){
			$('#tijianxiangmu_dan').datagrid('deleteRow', getRowIndex(row));
		}
		var xmmoney=$("#tjje").text();//得到选中项目总金额当前的值
		var xmmoneys=parseInt(xmmoney);//转换格式
		$("#tjje").text(xmmoneys-money);//重新赋值给总金额
	});
} 


//体检项目一键清空事件
$(function(){
	$("#tjqr").click(function(){
			 $("#tjje").text(0);//成功后重新赋值
			$('#tijianxiangmu_dan').datagrid("loadData",{total:0,rows:[]});
	});	
});

//药方一键清空事件
$(function(){
	$("#ypqr").click(function(){
		 $("#ypje").text(0);//成功后重新赋值
		$('#xiyaoping_dan').datagrid("loadData",{total:0,rows:[]});
		
	});
});

/*病历*/
$(function(){
	$("#binglichaxunbiao").datagrid({
		url:'findout',
		fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:6,
	    pageList:[6,6],
	    columns:[[
			{field:'outpatient_id',title:'门诊号',width:90,align:'center'},
			{field:'patient_name',title:'姓名',width:80,align:'center'},
			{field:'card_cid',title:'身份证号',width:200,align:'center'},
			{field:'patient_age',title:'年龄',width:80,align:'center'},
			{field:'medical_weight',title:'体重',width:80,align:'center'},
			{field:'medical_temperature',title:'体温',width:80,align:'center'},
			{field:'doctor_date',title:'生成日期',width:210,align:'center',formatter:comformatDate},
			{field:'medical_disease',title:'疾病',width:170,align:'center'},
			{field:'departments_name',title:'所挂科室',width:90,align:'center'},
			{field:'blys',title:'治病医生',width:80,align:'center'}
			
	    ]]
	});
	
});

//多个主从表新增  var mzh=$("#menghao").val();//得到门诊号存进vo类
$(function(){
	$("#zypqr").click(function(){
		var mzh=$("#menghao").val();//得到门诊号存进vo类
		if(mzh==''){
			$.messager.alert("温馨提示：","您还未添加病人！");
			return;
		}else{
		//药方表
		var yaofang=$("#xiyaoping_dan").datagrid("getRows");
		//医疗项目
		var yiliaoxiangmu=$("#zhiliaoxiangmu_dan").datagrid("getRows");		
		var tjxm=$('#tijianxiangmu_dan').datagrid("getRows"); 
			if(yaofang.length>0){
				$("<form method='post'>").appendTo("body").form({
					url:'addyf',
					onSubmit:function(param){
						var ypzje=$("#ypje").text();//得到选中项目总金额当前的值
						//alert("药方总金额"+ypzje);
						var zfnr=$("#zunr").val();//嘱咐内容
						var mzh=$("#menghao").val();//得到门诊号存进vo类
						
							param["pre.prescriptionMoney"]=ypzje;//得到药品总金额存进vo类
							param["pre.prescriptionContent"]=zfnr;//得到药方嘱咐内容存进vo类
							//门诊号
							param["pre.registeredPx.outpatientId"]=mzh;
							var rows=$("#xiyaoping_dan").datagrid("getRows");//得到详表信息就是表格里面的数据
							
							for (var i = 0; i < rows.length; i++) {
								$('#xiyaoping_dan').datagrid('endEdit',i);
								var a = rows[i].prescription_details_yl;
								var b = rows[i].prescription_details_ts;
								var c = rows[i].prescription_details_cs;
								if($.trim(a)==''||$.trim(b)==''||$.trim(c)==''){
									 $('#xiyaoping_dan').datagrid('beginEdit',i);
									return false;
								}
								
							}
							for(var i=0;i<rows.length;i++){
								if(rows[i]["gms"]==null){
									$.messager.alert("温馨提示：",rows[i]["drug_name"]+"请输入购买数量！");
									break;
								}else if(rows[i]["gms"]>rows[i]["ypkc"]){
									$.messager.alert("温馨提示：",rows[i]["drug_name"]+"开药数量不能大于当前药品库存数！");
									break;
								}else if(rows[i]["gms"]<=0){
									$.messager.alert("温馨提示：",rows[i]["drug_name"]+"购买数不能为零！");
									break;
								}else{
								//项目编号
								param["pres["+i+"].DrugsYk.drugId"]=rows[i]["drug_id"];
								//购买数量
								param["pres["+i+"].prescriptionDetailsSl"]=rows[i]["gms"];
								//服用天数
								param["pres["+i+"].prescriptionDetailsTs"]=rows[i]["prescription_details_ts"];
								//每天次数
								param["pres["+i+"].prescriptionDetailsCs"]=rows[i]["prescription_details_cs"];
								//单次用量
								param["pres["+i+"].prescriptionDetailsYl"]=rows[i]["prescription_details_yl"];
								//备注
								param["pres["+i+"].prescriptionDetailsRemark"]=rows[i]["prescription_details_remark"];
							}			
						}
					},
					success:function(d){
						if(parseInt(d)==1){
							 $("#ypje").text(0);//成功后重新赋值
				 			/* $('#xiyaoping_dan').datagrid("loadData",{total:0,rows:[]}); */
				 			var item = $('#xiyaoping_dan').datagrid('getRows');
				 			if (item) {
				 				for (var i = item.length - 1; i >= 0; i--) {
				 					var index = $('#xiyaoping_dan').datagrid('getRowIndex', item[i]);
				 					$('#xiyaoping_dan').datagrid('deleteRow', index);
				 				}
				 			} 
				 			$.messager.show({
								title:'提 示',
								msg:'药品开方成功！！！！！！！',
								height:200,
								timeout:1000,
								showType:'slide'
							 });
				 		}else{
				 			$.messager.alert("温馨提示：","药品开方失败！");
				 		}
					}
				}).submit();
			};
			
			if(yiliaoxiangmu.length>0){
				$("<form method='post'>").appendTo("body").form({
					url:'addysxm',
					onSubmit:function(param){
						var xmzje=$("#xmje").text();//得到选中项目总金额当前的值
						//alert("项目总金额"+xmzje);
						param["cus.projectZje"]=xmzje;//得到总金额存进vo类
						var mzh=$("#menghao").val();//得到门诊号存进vo类
						var ylkh=$("#ylkh").val();//得到医疗卡号存进vo类
						
							//门门诊号
							param["cus.registeredPx.outpatientId"]=mzh;
							//医疗卡号
							param["cus.medicalCardPx.mzcardId"]=ylkh;
							var rows=$("#zhiliaoxiangmu_dan").datagrid("getRows");//得到详表信息就是表格里面的数据
							console.log(rows);
							for(var i=0;i<rows.length;i++){
								//项目编号
								param["xcus["+i+"].CurePx.cureId"]=rows[i]["cure_id"];
							}	
					},
					success:function(d){
						if(parseInt(d)==1){
							$.messager.show({
								title:'提 示',
								msg:'医疗项目添加成功!!!!!!',
								height:200,
								timeout:1000,
								showType:'slide'
							 });
				 			$("#xmje").text(0);//成功后重新赋值
				 			/* $('#zhiliaoxiangmu_dan').datagrid("loadData",{total:0,rows:[]}); */
				 			var item = $('#zhiliaoxiangmu_dan').datagrid('getRows');
				 			if (item) {
				 				for (var i = item.length - 1; i >= 0; i--) {
				 					var index = $('#zhiliaoxiangmu_dan').datagrid('getRowIndex', item[i]);
				 					$('#zhiliaoxiangmu_dan').datagrid('deleteRow', index);
				 				}
				 			}
				 		}else{
				 			$.messager.alert("温馨提示：","医疗项目添加失败！");
				 		}
					}
				}).submit();
			}

			if(tjxm.length>0){
				$("<form method='post'>").appendTo("body").form({
					url:'xztjtzjl',
					onSubmit:function(param){
						var ylkh=$("#ylkh").val();//得到医疗卡号存进vo类
						
							//医疗卡号
							param["mc.mzcardId"]=ylkh;
							var rows=$("#tijianxiangmu_dan").datagrid("getRows");//得到详表信息就是表格里面的数据
							for(var i=0;i<rows.length;i++){
								//项目编号
								param["items["+i+"].examineItemId"]=rows[i]["examine_item_id"];
							}
					},
					success:function(d){
						if(parseInt(d)==1){
							$("#tjje").text(0);//成功后重新赋值
							$.messager.show({
								title:'提 示',
								msg:'体检项目添加成功!!!!!!',
								height:200,
								timeout:1000,
								showType:'slide'
							 });
				 			/* $('#tijianxiangmu_dan').datagrid("loadData",{total:0,rows:[]}); */
				 			var item = $('#tijianxiangmu_dan').datagrid('getRows');
				 			if (item) {
				 				for (var i = item.length - 1; i >= 0; i--) {
				 					var index = $('#tijianxiangmu_dan').datagrid('getRowIndex', item[i]);
				 					$('#tijianxiangmu_dan').datagrid('deleteRow', index);
				 				}
				 			}
				 		}else{
				 			$.messager.alert("温馨提示：","体检通知记录新增失败！");
				 		}
					}
				}).submit();
			}		
		}	
		
	});
	
});
//新增病历
$(function(){
	$("#scbl").click(function(){
		var mzh=$("#menghao").val();//得到门诊号
		if(mzh==''){
			$.messager.alert("温馨提示：","未添加病人信息！");
			return;
		}else{
			//病状
			var bz=$('#bz').val();
			//体重
			var tz=$('#tz').val();
			//体温
			var tw=$('#tw').val();
			var zdbz=$('#zdbz').val();//疾病
			if(bz==''){
				$.messager.alert("温馨提示：","病状信息为空！");
			}else if(tz==''){
				$.messager.alert("温馨提示：","体重信息为空！");
			}else if(zdbz==''){
				$.messager.alert("温馨提示：","病状信息为空！");
			}else if(!(/^[\u2E80-\u9FFF]+$/).test(bz)){
				$.messager.alert("温馨提示：","病状信息请输入中文！");
			}else if(!(/^\d*\.{0,1}\d{0,1}$/).test(tz)){
				$.messager.alert("温馨提示：","体重信息请输入数字！");
			}else if(!(/^\d*\.{0,1}\d{0,1}$/).test(tw)){
				$.messager.alert("温馨提示：","体温信息请输入数字！");
			}else {
			$.ajax({
				url:'addbl',
				type:'post',
				data:{
					"outpatient_id":mzh,
					"medical_symptoms":bz,
					"medical_weight":tz,
					"medical_temperature":tw,
					"medical_disease":zdbz
				},
				success:function(d){
					if(parseInt(d)==1){
						//病状
						$('#bz').textbox('setValue',null);
						//体重
						$('#tz').textbox('setValue',null);
						//体温
						$('#tw').textbox('setValue',null);
						$('#zdbz').textbox('setValue',null);//疾病
						 $("#binglichaxunbiao").datagrid("reload");
						$.messager.show({
							title:'提 示',
							msg:'病历新增成功',
							height:200,
							timeout:3000,
							showType:'slide'
						 });

			 		}else{
			 			$.messager.show({
							title:'提 示',
							msg:'病历新增失败',
							height:200,
							timeout:3000,
							showType:'slide'
						 });
			 		}
				}
			})
		
		}
		}
		
	});
});

$(function(){
	//根据名字查询中药
	$('#zhongname').searchbox({
		searcher:function(value,name){
			$("#zhongyao_xuan").datagrid({
				url:'nameZhongyao?drug_name='+value
			});
		}
	})
	//根据名字查询西药
	$('#xiname').searchbox({
		searcher:function(value,name){
			$("#xiyao_xuan").datagrid({
				url:'nameXiyao?drug_name='+value
			});
		}
	});
	
	//根据名字查询医疗项目
	$("#yiliaoname").searchbox({
		searcher:function(value,name){
			$("#yiliao_xuan").datagrid({
				url:'nameYiLiao?cure_name='+value
			});
		}
	});
	//根据名字查询体检项目
	$('#tijianname').searchbox({
		searcher:function(value,name){
			 $("#tjbg").datagrid({
					url:'tiJianName?examine_item_name='+value
				});
		}
	});
	//病历查询
	$('#exchangeSear').searchbox({
		searcher:function(value,name){
		    $('#binglichaxunbiao').datagrid({
		    	url:'medfindout',
				fitColumns:true,
				pagination:true,
			    pageNumber:1,
			    pageSize:6,
			    pageList:[6,6],
				queryParams:{
					mecard_number:value
				},
				});
		    } 
	});
	//根据医疗卡号查询体检结果信息
	$('#cw_br_name').searchbox({
		searcher:function(value,name){
			
			$("#tijian_biao").datagrid({
				url:'mztjjgYl?mecard_number='+value
			});
		}
	})
	//发往住院部事件
	$("#fwzhb").click(function(){
		var row =$('#tijian_biao').datagrid('getSelected');
		if(row==null){
			$.messager.alert("温馨提示：","未选择病人信息");
			return;
		}else{
			var rows=row.mzcard_id;
			$.ajax({
				url:'addhos',
				type:'post',
				data:{
					mzcard_id:rows,
					
				},
				success:function(d){
					if(parseInt(d)==1){
						$.messager.show({
							title:'提 示',
							msg:'发放成功',
							height:200,
							timeout:3000,
							showType:'slide'
						 });
					}else{
						$.messager.show({
							title:'提 示',
							msg:'发放失败',
							height:200,
							timeout:3000,
							showType:'slide'
						 });
					}
				}
			});
		}
	});
	//查询挂号记录添加病人时需要//呼叫病人----根据医疗卡查询
	$('#ghjljs').searchbox({
		searcher:function(value,name){
		    $('#bingren_patient').datagrid({
		    	url:'ysidcbr?mecard_number='+value
				
				});
		    } 
	});
});
</script>
<!-- ====================把病人门诊号存进隐藏域===================== -->
	<input type="hidden" type="text" id="menghao"/>
	<input type="hidden" type="text" id="ylkh"/>
	<input type="hidden" type="text" id="ylkkh"/>
			
	<div id="jiu_zheng" class="easyui-layout" style="border:none;margin:5px;width:1138px;">
		<div id="jiaohao_pxh" class="easyui-layout" style="border:none;width:1138px;">
		<fieldset class="shang" style="width:1110px;height:230px;margin-bottom:10px;border:1px solid #19AA8D;margin-top:-3px;">
				<legend>病人信息</legend>
				<form action="" id="cw_added" method="post">
					<p>
						<span>
							<a class='easyui-linkbutton queren' id="jiuzhenbingren"style="margin-left:15px;">添加病人</a>
						</span>
						<span style="margin-left:40px;">
							<input id="name_" class="easyui-textbox"  required="required"
									data-options="label:'病人姓名：',width:280,labelAlign:'right'">	
						</span>
						<span>
							<input  id="age_" class="easyui-textbox"  required="required"
							data-options="label:'病人年龄：',width:280,labelAlign:'right'">
						</span>
						<span>
							<input  id="sex_" class="easyui-textbox"  required="required"
							data-options="label:'病人性别：',width:280,labelAlign:'right'">
						</span>
					</p>
					<p style="margin-left:40px;">
						<span style="margin-left:88px;">
							<input  id="sfz_" class="easyui-textbox"  required="required"
								data-options="label:'身份证号：',width:280,labelAlign:'right'">
						</span>
						<span>
							<input id="dh_" class="easyui-textbox"  required="required"
								data-options="label:'联系电话：',width:280,labelAlign:'right'">
						</span>
						<span>
							<input  id="dizhi_" class="easyui-textbox"  required="required"
								data-options="label:'家庭地址：',width:280,labelAlign:'right'">
						</span>
					</p>
					<p style="margin-left:130px;margin-top:15px;">
						<span>
							<input id="bz" class="easyui-textbox"  required="required"
								data-options="label:'病人病状：',width:280,labelAlign:'right'">
						</span>
						<span>
							<input id="tz" class="easyui-textbox"  required="required"
								data-options="label:'病人体重：',width:280,labelAlign:'right'">
						</span>
						<span>
							<input id="tw" class="easyui-textbox"  required="required"
								data-options="label:'病人体温：',width:280,labelAlign:'right'">
						</span>
					</p>
					<p style="margin-left:128px;">
						<span>
							<input id="zdbz" class="easyui-textbox"  required="required"
							    data-options="label:'诊断病症：',width:650,labelAlign:'right'">
						</span>
					</p>				
					<p>
					    <div style="float:left;margin-top:-10px;"><a id="scbl" class='easyui-linkbutton' style="margin-left:855px;">生成病历</a></div>
					</p>	
			</form>
		</fieldset>
	<div style="widtd:1135px;margin-top:10px;margin-right:20px;">
			<div style="float:right;margin-bottom:10px;">
				<input type="button" id="zypqr" style="width:100px;height:30px;margin-left:230px;background:#19AA8D;color:white;border:none" value="生成结单"/>
			</div>	
	</div>
	<div id="zhongjianyaofang_pxh" class="easyui-tabs" style="border:1px solid #19AA8D;width:1135px;height:422px;">
	<!-- 开设处方 -->
	<div title="开设处方" style="margin-top:8px;">
		<div style="float:left;width:402px;border:none;"class="easyui-tabs">
			<div title="中药">
				<div style="margin:5px;">
					<input name="zhong_Id2" id="zhongname" class="easyui-searchbox"
					data-options="label:'药品检索',prompt:'药品检索',width:280,labelAlign:'right'">				
				</div>
					<table  id="zhongyao_xuan" class="easyui-datagrid" singleSelect="true" style="height:290px;width:400px;"
			    		data-options="fitColumns:true,">
					</table>
			</div>
			<div  title="西药">
				<div style="margin:5px;">
					<input name="zhong_Id2" id="xiname" class="easyui-searchbox"
					data-options="label:'药品检索',prompt:'药品检索',width:280,labelAlign:'right'">		
				</div>
				<table  id="xiyao_xuan" singleSelect="true" class="easyui-datagrid" style="height:290px;width:400px;"
			    		data-options="fitColumns:true,">
				</table>
			</div>
		</div>
			<!-- 处方信息 -->
			<fieldset style="width:675px;height:345px;float:left;margin-left:10px;border:1px solid #19AA8D;">
			<legend>处方信息</legend>
				<table id="xiyaoping_dan" class="easyui-datagrid" singleSelect="true" style="height:280px;width:675px"
			    		data-options="fitColumns:true,pagination:true,pageNumber:1,pageSize:5,pageList:[5]">
				<thead>   
					   <tr>   
					   	  <th data-options="field:'drug_id',width:69,align:'center'">药品编号</th>
					   	  <th data-options="field:'ypkc',hidden:true,width:69,align:'center'">药品库存</th>  
						  <th data-options="field:'drug_name',width:79,align:'center'">药品名称</th>   
						  <th data-options="field:'drug_selling_price',width:69,align:'center'">单价</th>  
						  <th data-options="field:'gms',width:59,align:'center'" editor="{type:'numberspinner',options:{min:1}}">购买数量</th>
						  <th data-options="field:'prescription_details_yl',width:69,align:'center'"editor="{type:'combobox',options:{
						 	 valueField: 'label',
							textField: 'value',
							panelHeight:'auto',
							data:[{
								label: '一次一粒',
								value: '一次一粒'
							},{
								label: '一次二粒',
								value: '一次二粒'
							},{
								label: '一次三粒',
								value: '一次三粒'
							}]}}">单次用量</th>   
						  <th data-options="field:'prescription_details_ts',width:69,height:64,align:'center'" editor="{type:'combobox',options:{
						  	 valueField: 'label',
							textField: 'value',
							panelHeight:'auto',
							data:[{
								label: '三天',
								value: '三天'
							},{
								label: '五天',
								value: '五天'
							},{
								label: '一周',
								value: '一周'
							}]}}">服用天数</th>  
						  <th data-options="field:'prescription_details_cs',width:69,height:64,align:'center'"
						  editor="{type:'combobox',options:{
						  	valueField: 'label',
							textField: 'value',
							panelHeight:'auto',
							data:[{
								label: '一天一次',
								value: '一天一次'
							},{
								label: '一天两次',
								value: '一天两次'
							},{
								label: '一天两次',
								value: '一天两次'
							}]}}">每天次数</th>    
 					     <th data-options="field:'cazuo',width:69,align:'center',formatter:formatAction">操作</th>
						  
					   </tr>   
					</thead>
					</table>
					<div class="xingxiqueren_" style="height:30px;margin-top:10px;margin-left:-35px;">	
						<span style="width:500px;">
							<div style="margin-left:35px;float:left;width:120px;padding:5px;">总计:<span style="color:red;"id="ypje">0</span>元</div>
							<div style="float:left"><a id="ypqr" class='easyui-linkbutton' style="margin-left:5px;">一键清空</a></div>
						</span>
					</div>
			</fieldset>
			</div>
			<!-- 医疗项目 -->		
			<div title="医疗项目" style="margin-top:8px;">
					<div class="yiliaozuo" style="float:left;">
						<div style="margin-bottom:10px;">
								<input name="Yi_Id2" id="yiliaoname" class="easyui-searchbox"
								data-options="label:'项目检索',prompt:'项目检索',width:280,labelAlign:'right'">
						</div>
						
						<table  id="yiliao_xuan" singleSelect="true" class="easyui-datagrid" style="height:290px;width:470px;"
				    		data-options="fitColumns:true">
				   			
						</table> 
					</div>
				<!-- 医疗项目单 -->
				<fieldset style="width:550px;height:310px;float:left;margin-top:5px;margin-left:5px;border:1px solid #19AA8D;">
						<legend>治疗项目单</legend>
						<table id="zhiliaoxiangmu_dan" singleSelect="true" class="easyui-datagrid" style="height:250px;width:610px"
				    		data-options="fitColumns:true,pagination:true,pageNumber:1,pageSize:5,pageList:[5]">
						</table>
						<div class="yiliaoxingxiqueren_" style="height:30px;margin-top:10px;margin-left:-35px;">
							<span style="width:500px;">
								<div style="margin-left:35px;float:left;width:120px;padding:5px;">总计:<span style="color:red;"id="xmje">0</span>元</div>
								<div style="float:left"><a id="xmqr" class='easyui-linkbutton' style="margin-left:5px;">一键清空</a></div>
							</span>
						</div>
					</fieldset>		
			</div>
			<!-- 开设体检 -->		
			<div title="开设体检">
						<div  style="height:270px;">
							<div class="tijianzuo" style="float:left;">
								<div style="margin-bottom:10px;margin-top:10px;">
											<input name="Yi_Id2" id="tijianname" class="easyui-searchbox"
											data-options="label:'项目检索',prompt:'项目检索',width:280,labelAlign:'right'">
									 
								</div>
								 
								<table  id="tjbg" singleSelect="true" class="easyui-datagrid" style="height:290px;width:470px;"
		    						data-options="fitColumns:true">
		   			
								</table> 
							</div>
						<!-- 体检项目单 -->
							<fieldset style="width:550px;height:310px;float:left;margin-top:15px;margin-left:5px;border:1px solid #19AA8D;">
								<legend>体检项目单</legend>
								<table id="tijianxiangmu_dan" singleSelect="true" class="easyui-datagrid" style="height:250px;width:610px"
							    		data-options="fitColumns:true,pagination:true,pageNumber:1,pageSize:5,pageList:[5]">
							   				
							   		
								</table>
								<div class="tijianqueren_" style="height:30px;margin-top:10px;margin-left:-35px;">
								<span style="width:500px;">
									<div style="margin-left:35px;float:left;width:120px;padding:5px;">总计:<span style="color:red;"id="tjje">0</span>元</div>
									<div style="float:left"><a id="tjqr" class='easyui-linkbutton' style="margin-left:5px;">一键清空</a></div>
								</span>
								
								</div>
							</fieldset>
					</div>
			</div>
			<div title="查看体检结果" >
						<fieldset class="tijianjieguo_pxh" style="width:1090px;height:345px;border:1px solid #19AA8D">
							<legend>体检结果</legend>
							<p>
							&nbsp;&nbsp;&nbsp;记录检索：<input name="User_id" id="cw_br_name" class="easyui-searchbox"
								data-options="label:'',prompt:'记录检索',prompt:'请输入医疗卡号或体检号',width:200,labelAlign:'right'">
								
								<a class='easyui-linkbutton xingqi'id="fwzhb" style="margin-left:280px;">发住院部</a>
							</p>
							<span>
								<div style="margin-bottom:10px;">
									<table  id="tijian_biao" class="easyui-datagrid" singleSelect="true" style="height:250px;width:1085px;">
									</table> 
								</div>
							</span>
						</fieldset>
			</div>
			<!-- 生成病历 -->
			<div title="病历查询">
						<fieldset class="binglichaxun" style="width:1080px;height:370px;margin-left:10px;border:1px solid #19AA8D">
						<legend>病历查询</legend>
							<p style="margin-left:20px;">
								<input id="exchangeSear" class="easyui-searchbox" style="width:280px;height:30px;"
								data-options="label:'记录检索：',prompt:'请输入医疗卡号或门诊号',labelAlign:'right'">
							</p>
							
							<table id="binglichaxunbiao" singleSelect="true" class="easyui-datagrid" style="height:280px;width:1070px">
					   		
							</table>	
						</fieldset>
			</div>
		</div>
	</div>
	</div>	
		<!-- 体检详情弹框 -->
		<div id="tijianxq" class="easyui-window" title="体检详情" style="width:600px;padding:10px;"
			data-options="iconCls:'icon-save',modal:true,closed:true">
				<span>
						<p>
							<input name="yiliaokahao_" id="cw_adjustment_id1" class="easyui-textbox"  
									data-options="label:'医疗卡号：',width:260,labelAlign:'right'">
							<input name="tijianhao_" id="cw_adjustment_id2" class="easyui-textbox"  
									data-options="label:'体检号：',width:260,labelAlign:'right'">
						</p>
						<p>
							<input id="cw_adjustment_id3" class="easyui-textbox"  
									data-options="label:'病人姓名：',width:260,labelAlign:'right'">			
							<input name="Age_" id="cw_adjustment_id4" class="easyui-textbox"  
							data-options="label:'病人年龄：',width:260,labelAlign:'right'">
						</p>
						<p>	
							<input id="cw_adjustment_id5" class="easyui-textbox"  
									data-options="label:'病人性别：',width:260,labelAlign:'right'">	
								<input name="tijianyisheng_" id="cw_adjustment_id6" class="easyui-textbox"  
								data-options="label:'体检医生：',width:260,labelAlign:'right'">  
						</p>
						<table id="exTable2" style="height:220px;width:550px;"; class="easyui-datagrid" data-options="fitColumns:true,singleSelect:true">
						</table>					                          
				</span>	
		</div>
		<!-- 添加病人 -->
		<div id="tianjiabingren" class="easyui-window" title="呼叫病人" style="width: 820px"
				data-options="iconCls:'',modal:true,closed:true">
			
			<div class="easyui-layout" style="height:50px;background-color:#C8F7F7;padding:16px;">
				<a id="bingrencha" href="#" class="easyui-linkbutton"
						data-options="iconCls:'icon-add',plain:true" style="width:80px,background-color:#D6FEFD;">确认</a>
				<input id="ghjljs" class="easyui-searchbox" style="width:280px;height:30px;"
						data-options="label:'记录检索：',prompt:'请输入医疗卡号或门诊号',labelAlign:'right'">
			</div>
				<!--就诊时呼叫病人的表格  -->
				<table  id="bingren_patient" class="easyui-datagrid" singleSelect="true" style="height:480px;border:1px solid black;"
			    	url="ysidcbr"
			    	data-options="pagination:true,pageNumber:1,pageSize:5,pageList:[5]">
			   		 <thead>
						<tr>
							<th hidden="true"  data-options="field:'mzcard_id',width:160,align:'center'">编号</th>
							<th data-options="field:'mecard_number',fixed:false,resiable:true,width:120,align:'center'">医疗卡编号</th>
							<th data-options="field:'patient_name',fixed:false,resiable:true,width:85,align:'center'">病人姓名</th>
							<th data-options="field:'patient_age',fixed:false,resiable:true,width:85,align:'center'">病人年龄</th>
							<th data-options="field:'patient_sex',fixed:false,resiable:true,width:85,align:'center'">病人性别</th>
							<th data-options="field:'card_cid',fixed:false,resiable:true,width:180,align:'center'">病人身份证号</th>
							<th data-options="field:'registration_date',fixed:false,resiable:true,width:145,align:'center',formatter:comformatDate">挂号时间</th>
							<th data-options="field:'departments_name',fixed:false,resiable:true,width:100,align:'center'">所挂科室</th>
						</tr>	
				    </thead>
				</table>
		</div>		
</body>
</html>